import formJs from "./regexDetail.js"; //新增弹框配置项
import publicForm from "@/components/public/el-form.vue"; //弹框form
import TableData from "@/components/public/el-table"; //列表
import imgBox from "../img.vue"; //列表
import actions from "@/actions";
import FormLyout from '@/components/commonPublic/fromLayout.vue'



import {
    getPileFoundationDataDetailByFid, //详情

} from "@/api/request.js";


export default {
    props: [
        "dialogVisible", //弹框是否展示
        "dialogTitle", //标题
        "statusNum", //按钮编号
        "currentRow", //当前行
        "fCompanyid",
        "fCompanyname",
       
    ],
    data() {
        return {
        
            // 页签切换
            typeData: [{
                text: "桩信息",
                show: true
            },
            {
                text: "监测信息",
                show: false
            },
            {
                text: "曲线",
                show: false
            },
            {
                text: "波列图",
                show: false
            },
            ],
            // 页签切换
            visible: "", //弹框展示隐藏
            title: null, //弹框标题
           
            dialogHeight: null, //弹框高度
           

            formObj: formJs.formObj,
            table_config: formJs.table_config, //列表
            // 桩信息
            formData: {},
            tableData:[],
            graphfileLists:[],//曲线
            polarogramfileLists:[],//雷达
            loading: false, //列表转载
            statusNum:null,
         
           

        };
    },
    components: {
        publicForm,
        TableData,
        imgBox,
        FormLyout
        
    },


    mounted() {
        this.primaryInfo = JSON.parse(sessionStorage.getItem("GxEmbedded_primaryInfo"))
        this.statusNum=this.primaryInfo.status;
        this.currentDetail=this.primaryInfo.data;
        actions.onGlobalStateChange((state, prev) => {
            var data = prev.currentUser.projects;
            this.userInfo = prev.currentUser
        }, true);
       if (this.statusNum == 7) { //查看
            this.btnShow = false //按钮
            this.getDetail({
                fId: this.currentDetail.fId
            }) 

        }
        

    },
    methods: {
        // 页签切换
        changeType(e, index) {
            for (let i in this.typeData) {
                if (parseFloat(i) === index) {
                    this.typeData[i].show = true;
                } else {
                    this.typeData[i].show = false;
                }
            }
            // this.typeDataNum = index;
        },
    
        // 详情
         // 详情
         getDetail(obj) {
            this.loading = true;
            getPileFoundationDataDetailByFid(obj).then((res) => {
                if (res.errcode == 0) {
                    this.loading = false;
                    var data = res.data;
                    this.formData = data.info;
                  
                    // res.data.infoList.map(item=>{
                    //     item.fGraphfile="http://1.14.103.201:8301//fileAnnexes/20240325/1711354254033445911398088773/bd82b60c-a4d5-4031-b24b-f80273726bca.jpg"
                    // })
                    this.tableData=res.data.infoList;
                    this.graphfileLists=res.data.graphfileLists;//曲线
                    this.polarogramfileLists=res.data.polarogramfileLists;//雷达

                    if (this.statusNum == 7) {
                        this.btnShow = false
                        this.formObj.map((item) => {
                            item.disabled = true;
                        });
                    }
                } else {
                    this.loading = false;
                    this.$message.error(res.msg);
                }
            });
        },
        
    },
};